Skip to content

Conversation

@hanhanW
Copy link
Contributor

@hanhanW hanhanW commented Nov 8, 2025

This commit completes the migration from the deprecated GEN_PASS_CLASSES
to the new GEN_PASS_DEF infrastructure across all torch-mlir passes.

Changes include:

  1. Remove PassDetail.h files (deprecated pattern)

    • Deleted lib/Conversion/PassDetail.h
    • Deleted lib/RefBackend/PassDetail.h
    • Deleted lib/Dialect/Torch/Transforms/PassDetail.h
    • Deleted lib/Dialect/TorchConversion/Transforms/PassDetail.h
    • Deleted lib/Dialect/TMTensor/Transforms/PassDetail.h
  2. Migrate conversion passes to GEN_PASS_DEF

    • Updated all passes in lib/Conversion/ to use #define GEN_PASS_DEF_*
    • Removed GEN_PASS_DECL from .cpp files (move to headers where needed)
    • Fixed includes and namespace declarations
  3. Migrate dialect transform passes

    • Updated Torch, TorchConversion, and TMTensor transform passes
    • Properly scoped GEN_PASS_DEF in namespace blocks
  4. Handle passes with options (TorchToStablehlo, TorchToTosa)

    • Added GEN_PASS_DECL_* to headers
    • Implemented default and convenience create functions
    • Used generated constructors via using BaseClass::BaseClass
  5. Handle passes without options (RefBackend)

    • Removed manual create function implementations
    • Let tablegen auto-generate create functions
    • Added using declarations for Base classes in impl namespace
  6. Fix backend type conversion passes

    • Added missing create functions in BackendTypeConversionPasses.cpp
    • Fixed namespace scoping issues
  7. Fix missing namespace closures

    • Added proper closing namespace comments in Verify*BackendContract.cpp

The migration maintains full backward compatibility while adopting the
recommended LLVM pass infrastructure patterns. All passes now use the
generated base classes and follow consistent patterns based on whether
they have options defined in tablegen.

This is the preparation for llvm/llvm-project#166904

Signed-off-by: hanhanW [email protected]

@hanhanW hanhanW force-pushed the users/hanhanW/evolve-tablegen branch 2 times, most recently from 35dc907 to e3c7f56 Compare November 11, 2025 18:08
This commit completes the migration from the deprecated GEN_PASS_CLASSES
to the new GEN_PASS_DEF infrastructure across all torch-mlir passes.

Changes include:

1. Remove PassDetail.h files (deprecated pattern)
   - Deleted lib/Conversion/PassDetail.h
   - Deleted lib/RefBackend/PassDetail.h
   - Deleted lib/Dialect/Torch/Transforms/PassDetail.h
   - Deleted lib/Dialect/TorchConversion/Transforms/PassDetail.h
   - Deleted lib/Dialect/TMTensor/Transforms/PassDetail.h

2. Migrate conversion passes to GEN_PASS_DEF
   - Updated all passes in lib/Conversion/ to use #define GEN_PASS_DEF_*
   - Removed GEN_PASS_DECL from .cpp files (move to headers where needed)
   - Fixed includes and namespace declarations

3. Migrate dialect transform passes
   - Updated Torch, TorchConversion, and TMTensor transform passes
   - Properly scoped GEN_PASS_DEF in namespace blocks

4. Handle passes with options (TorchToStablehlo, TorchToTosa)
   - Added GEN_PASS_DECL_* to headers
   - Implemented default and convenience create functions
   - Used generated constructors via `using BaseClass::BaseClass`

5. Handle passes without options (RefBackend)
   - Removed manual create function implementations
   - Let tablegen auto-generate create functions
   - Added using declarations for Base classes in impl namespace

6. Fix backend type conversion passes
   - Added missing create functions in BackendTypeConversionPasses.cpp
   - Fixed namespace scoping issues

7. Fix missing namespace closures
   - Added proper closing namespace comments in Verify*BackendContract.cpp

The migration maintains full backward compatibility while adopting the
recommended LLVM pass infrastructure patterns. All passes now use the
generated base classes and follow consistent patterns based on whether
they have options defined in tablegen.

Signed-off-by: hanhanW <[email protected]>
@hanhanW hanhanW force-pushed the users/hanhanW/evolve-tablegen branch from e3c7f56 to 4572127 Compare November 11, 2025 18:09
@hanhanW hanhanW requested a review from sjarus November 12, 2025 19:00
@hanhanW hanhanW marked this pull request as ready for review November 12, 2025 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants